//
//  XMUserInfoCountView.m
//  XMWeibo
//
//  Created by chi on 14-9-2.
//  Copyright (c) 2014年 xiaoming. All rights reserved.
//

#import "XMUserInfoCountView.h"


@interface XMUserInfoCountView ()

/** 数量 */
@property(nonatomic, weak) UILabel *infoCount;

/** 文本 */
@property (nonatomic, weak) UILabel *infoText;

@end

@implementation XMUserInfoCountView

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        
        [self addTarget:self action:@selector(click) forControlEvents:UIControlEventTouchUpInside];

        [self setup];
    }
    return self;
}


- (void)setHighlighted:(BOOL)highlighted
{
    if (highlighted) {
        self.infoCount.textColor = [UIColor grayColor];
        self.infoText.textColor = [UIColor lightGrayColor];
    }
    else {
        self.infoCount.textColor = [UIColor blackColor];
        self.infoText.textColor = [UIColor grayColor];
    }
}


- (void)setup
{
    // 数量
    UILabel *infoCount = [[UILabel alloc]init];
    infoCount.backgroundColor = [UIColor clearColor];
    infoCount.textAlignment = NSTextAlignmentCenter;
    infoCount.font = [UIFont systemFontOfSize:14.0];
    self.infoCount = infoCount;
    [self addSubview:infoCount];
    
    // 文本
    UILabel *infoText = [[UILabel alloc]init];
    infoText.backgroundColor = [UIColor clearColor];
    infoText.textAlignment = NSTextAlignmentCenter;
    infoText.font = [UIFont systemFontOfSize:14.0];
    infoText.textColor = [UIColor grayColor];
    self.infoText = infoText;
    [self addSubview:infoText];
    
   
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    
    CGFloat width = self.bounds.size.width;
    CGFloat height = self.bounds.size.height * 0.5;
    
    self.infoCount.frame = CGRectMake(0.0, 10.0, width, height - 10.0);
    self.infoText.frame = CGRectMake(0.0, height, width, height - 5.0);
    
}

- (void)setCount:(NSUInteger)count
{
    self.infoCount.text = [NSString stringWithFormat:@"%d", count];
}

- (void)setText:(NSString *)text
{
    self.infoText.text = text;

}

- (void)click
{
    
}

@end
